<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

<div class="panel-body" >
    <div id="box" style="display: flex;flex-direction: row;align-items: center;justify-content: space-between" >
        <button id="stop_server" data-type="button" class="btn btn-outline-info">关闭服务</button>
        <button id="start_server" data-type="button" class="btn btn-outline-info">开启服务</button>
        <button id="clear_file" data-type="button" class="btn btn-outline-info">清空文件</button>
    </div>

</div>


<script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/4.5.3/js/bootstrap.min.js"></script>
<link href="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/4.5.3/css/bootstrap.min.css" rel="stylesheet">

<script>
    $('#stop_server').click(function (){
        console.log("sss")
        send("/admin/server/stop")
    })

    $('#start_server').click(function (){
        send("/admin/server/start")
    })

    $('#clear_file').click(function (){
        send("/admin/server/clear")
    })

    function send(url){
        $.ajax({
            url:url,
            async:true,
            dataType : 'json',
            type:"get",
            success:function (res){
                console.log(res)
                if(res.code==200){
                    alert(res.msg+" "+res.data);
                }else{
                    alert(res.msg);
                }

            }
        })
    }
</script>

</body>
</html>